<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <!--{include file='comm/comm_editor.tpl'}-->
    <!--{include file="comm/icheck.tpl"}-->
    <title>商品录入-生产信息</title>
</head>
<style>
.img-left{
	float:left;
	margin-left:12px;
}
.img-delete{
	width:160px;
	height:48px;
	line-height:48px;
	text-align:center;
}

.img-thumbnail{
	width:160px;
	height:160px;
}

#specSel{
	margin-top:6px;
	width:912px;
}

.form-rewrite{
	width:420px;
}

#fitSel,#intervalTime{
	margin-top:18px;
	width:650px;
}

#costTa table td{
	line-height:33px;
}

.grayBk{
	background:#CCCCCC;
}
</style>
<body>

<div class="container">

    <div class="comm_content" style="margin-bottom:100px;">
        	<ul role="tablist" class="nav nav-tabs">
				<li class="group_box active">
					<a href="javascript:void(0);">生产信息</a>
				</li>
                <button type="button" class="btn btn-primary" style="float: right;margin:4px 15px 0px 0px;" onclick="history.go(-1)">返回上一级</button>
            </ul>
			
        	<div class="form-horizontal">
        		<!--用于判断是商品添加还是商品编辑-->
				<div class="form-group" style="width:800px;padding:10px;margin-bottom:0px;">
					<label class="col-sm-3 control-label" for="cityID" style="width:18%;"><span class="red">*</span> 商品所属城市：</label>
					<div class="col-sm-9" style="width:82%;">
						<select name="cityID" id="cityID" class="form-control w150" disabled>
							<option value="0">请选择</option>
							<!--{foreach from=$editInfo->city item=c}-->
								<option value="<!--{$c.id}-->"><!--{$c.name}--></option>
							<!--{/foreach}-->
						</select>
					</div>
				</div>
				
				<div class="form-group" style="width:800px;padding:10px;margin-bottom:0px;">
					<label class="col-sm-3 control-label" for="categoryID" style="width:18%;"><span class="red">*</span> 商品类目：</label>
					<div class="col-sm-9" style="width:82%;">
						<select name="categoryID" id="categoryID" class="form-control w150" disabled>
							<option value="0">请选择</option>
							<!--{foreach from=$editInfo->category item=c}-->
								<option value="<!--{$c.bigCategoryID}-->"><!--{$c.name}--></option>
							<!--{/foreach}-->
						</select>
					</div>
				</div>
				
				<div class="form-group" style="width:800px;padding:10px;margin-bottom:0px;">
					<label class="col-sm-3 control-label" for="goods-name" style="width:18%;"><span class="red">*</span> 商品名称：</label>
					<div class="col-sm-9" style="padding-left:0px;width:82%;">
						<div class="form-group">
							<label class="col-sm-3 control-label" for="goodsName" style="width:9%;">中文</label>
							<div class="col-sm-9" style="padding:0px;width:91%;">
								<input type="text" name="goodsName" id="goodsName" class="form-control w300" maxlength="15" disabled>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label" for="frenchName" style="width:9%;">法文</label>
							<div class="col-sm-9" style="padding:0px;width:91%;">
								<input type="text" name="frenchName" id="frenchName" class="form-control w300" maxlength="30" disabled>
							</div>
						</div>
					</div>
				</div>
				
				<div class="form-group" id="goodsSpec" style="padding:10px;margin-bottom:0px;">
					<label class="col-sm-3 control-label" for="spec" style="width:11.5%;padding-bottom:15px;"><span class="red">*</span> 商品规格：</label>
					<div class="col-sm-9" id="costTa" style="width:1080px;">
						<table class="table table-bordered">
							<thead>
								<tr>
									<!--{if $cost_permission || $detail_permission}-->
										<th width="10%" style="text-align:center;">操作</th>
									<!--{/if}-->
									<th width="6%" class="grayBk" style="text-align:center;">规格</th>
									<th width="6%" class="grayBk" style="text-align:center;">SKU</th>
									<th width="6%" class="grayBk" style="text-align:center;">售价</th>
									<!--{if $detail_permission}-->
										<th width="15%" style="text-align:center;">QS生产单品名</th>
										<th width="19%" style="text-align:center;">配料</th>
										<th width="8%" style="text-align:center;">净含量</th>
									<!--{/if}-->
									<!--{if $cost_permission}-->
										<th width="10%" class="cost" style="text-align:center;">不含税成本</th>
										<th width="10%" class="cost" style="text-align:center;">含税成本</th>
										<th width="10%" class="cost" style="text-align:center;">销售结算价</th>
									<!--{/if}-->
								</tr>
							</thead>
							<tbody>
								<!--{if isset($editInfo->saleGoods) && $editInfo->saleGoods != ''}-->
									<!--{foreach from=$editInfo->saleGoods item=sale}-->
										<tr>
											<!--{if $cost_permission || $detail_permission}-->
												<td style="text-align:center;">
													<!--{if $cost_permission}-->
														<a href="javascript:void(0);" onclick="goodsAdd.editCost(<!--{$sale.postID}-->, '<!--{$sale.specName}-->');">成本</a>
													<!--{/if}-->
													<!--{if $detail_permission}-->
														<a href="javascript:void(0);" onclick="goodsAdd.editDetail(<!--{$sale.postID}-->, '<!--{$sale.specName}-->');">详情</a>
													<!--{/if}-->
												</td>
											<!--{/if}-->
											<td style="text-align:center;" class="grayBk"><!--{$sale.specName}--></td>
											<td class="grayBk"><!--{$sale.product_code}--></td>
											<td class="grayBk"><!--{$sale.salePrice}--></td>
											<!--{if $detail_permission}-->
												<td id="qs_<!--{$sale.postID}-->">
													<!--{if isset($sale.qsName)}--> 
														<!--{$sale.qsName|default:''}-->
													<!--{/if}-->
												</td>
												<td id="ingre_<!--{$sale.postID}-->">
													<!--{if isset($sale.recipe)}--> 
														<!--{$sale.recipe|default:''}--> 
													<!--{/if}-->
												</td>
												<td id="net_<!--{$sale.postID}-->">
													<!--{if isset($sale.weight)}-->
														<!--{$sale.weight|default:''}-->
													<!--{/if}-->
												</td>
											<!--{/if}-->
											
											<!--{if $cost_permission}-->
												<td id="noInCost_<!--{$sale.postID}-->">
													<!--{if isset($sale.noTaxCost)}-->
														<!--{$sale.noTaxCost}-->
													<!--{/if}-->
												</td>
												
												<td id="inCost_<!--{$sale.postID}-->">
													<!--{if isset($sale.taxCost)}-->
														<!--{$sale.taxCost}-->
													<!--{/if}-->
												</td>
												
												<td id="saleCost_<!--{$sale.postID}-->">
													<!--{if isset($sale.checkPrice)}-->
														<!--{$sale.checkPrice}-->
													<!--{/if}-->
												</td>
											<!--{/if}-->
										</tr>
									<!--{/foreach}-->
								<!--{/if}-->
							</tbody>
						</table>
					</div>
				</div>
	        </div>   
        </div>
    
</div>

<!--编辑成本弹出层-->
<!--{if $cost_permission}-->
	<div id="popCost" style="display:none;">
	
	    <form class="form-horizontal" id="costForm" onsubmit="return false;">
	
	        <div class="form-group">
	            <label for="noTaxCost" class="col-sm-3 control-label"><span class="red">*</span> 不含税成本：</label>
	            <div class="col-sm-9">
	                <input type="text" class="form-control w150" id="noTaxCost" name="noTaxCost" maxlength="10" />
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label for="taxCost" class="col-sm-3 control-label"><span class="red">*</span> 含税成本：</label>
	            <div class="col-sm-9">
	                <input type="text" class="form-control w150" id="taxCost" name="taxCost" maxlength="10" />
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label for="checkPrice" class="col-sm-3 control-label"><span class="red">*</span> 销售结算价：</label>
	            <div class="col-sm-9">
	                <input type="text" class="form-control w150" id="checkPrice" name="checkPrice" maxlength="10" />
	            </div>
	        </div>
	
	    </form>
	
	</div>
<!--{/if}-->

<!--编辑详情弹出层-->
<!--{if $detail_permission}-->
	<div id="popDetail" style="display: none;">
	
	    <form class="form-horizontal" id="detailForm" onsubmit="return false;">
	    
	    	<div class="form-group">
	            <label for="recipe" class="col-sm-3 control-label" style="width:18%;"><span class="red">*</span> 配料：</label>
	            <div class="col-sm-9" style="width:82%;">
	                <textarea class="form-control w300" id="recipe" name="recipe" placeholder=""></textarea>
	            </div>
	        </div>
	        
	        <div class="form-group">
	            <label for="netWeight" class="col-sm-3 control-label" style="width:18%;"><span class="red">*</span> 净含量：</label>
	            <div class="col-sm-9" style="width:82%;">
	                <input type="text" class="form-control w300" id="netWeight" name="netWeight" maxlength="50" />
	            </div>
	        </div>
	    	
	        <div class="form-group">
	            <label for="qsName" class="col-sm-3 control-label" style="width:18%;"><span class="red">*</span> QS生产单品名：</label>
	            <div class="col-sm-9" style="width:82%;">
	                <input type="text" class="form-control w300" id="qsName" name="qsName" maxlength="100" />
	            </div>
	        </div>

	        <div class="form-group" style="width:800px;padding:10px;margin-bottom:0px;">
				<label class="col-sm-3 control-label" for="pGroupID" style="width:18%;"><span class="red">*</span> 生产信息维度：</label>
				<div class="col-sm-9" style="width:82%;">
					<div>
						<select name="pGroupID" id="pGroupID" class="form-control w300" multiple style="display:inline-block;height:110px;">
							<!--{foreach from=$editInfo->product item=p}-->
								<option value="<!--{$p.pGroupID}-->"><!--{$p.pGroupName}--></option>
							<!--{/foreach}-->
						</select>
						<span style="display:inline-block;vertical-align:middle;height:110px;">
							<button class="btn btn-primary" type="button" style="display:block;margin:15px 0 15px;" onclick="goodsAdd.batchProduct();">批量添加生产信息</button>
							<button class="btn btn-default" type="button" onclick="goodsAdd.openProduct();">生产信息维护</button>
						</span>
					</div>
					<div id="productSel">
						<table></table>
					</div>
				</div>
			</div>
			
			<div class="form-group" style="width:800px;padding:10px;margin-bottom:0px;margin-top:22px;">
				<label class="col-sm-3 control-label" for="nGroupID" style="width:18%;"><span class="red">*</span> 营养成分：</label>
				<div class="col-sm-9" style="width:82%;">
					<div>
						<select name="nGroupID" id="nGroupID" class="form-control w300" multiple style="display:inline-block;height:110px;">
							<!--{foreach from=$editInfo->nutrition item=n}-->
								<option value="<!--{$n.nGroupID}-->"><!--{$n.nGroupName}--></option>
							<!--{/foreach}-->
						</select>
						<span style="display:inline-block;vertical-align:middle;height:110px;">
							<button class="btn btn-primary" type="button" style="display:block;margin:15px 0 15px;" onclick="goodsAdd.batchNutri();">批量添加营养成分</button>
							<button class="btn btn-default" type="button" onclick="goodsAdd.openNutri();">营养成分信息维护</button>
						</span>
					</div>
					<div id="natriSel">
						<table></table>
					</div>
				</div>
			</div>
	    </form>
	
	</div>
<!--{/if}-->
<!--{include file='comm/footer.tpl'}-->
</body>
</html>
<script>
	
	$(function(){
		//编辑初始化
		<!--{if isset($editInfo) && $editInfo != ''}-->
			$('#cityID').val('<!--{$editInfo->cityID}-->');
			$('#categoryID').val('<!--{$editInfo->bigCategoryID}-->');
			$('#goodsName').val('<!--{$editInfo->goodsName}-->');
			$('#frenchName').val('<!--{$editInfo->frenchName}-->');
		<!--{/if }-->

	})
    
    //商品主信息添加操作对象
	var goodsAdd = {
		
		//三级商品网购号
		tPostID: 0,
		
		spec: '',
		
		dt: '',
		
		//编辑成本
		editCost: function(postID, spec){
			
			if (!E.isInt(postID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			
			this.tPostID = postID;
			this.spec = spec;
			E.popup.open({
                id:"popCost",
                title: '编辑成本-' + spec,
                css: "width: 600px;",
                btnName: "保存",
                btnCall:"goodsAdd.check(1);"
            });
            
            var Cost_1 = E.trim($('#noInCost_' + postID).html());
            var Cost_2 = E.trim($('#inCost_' + postID).html());
            var Cost_3 = E.trim($('#saleCost_' + postID).html());

            if (Cost_1 != '' && Cost_2 != '' && Cost_3 != '') {
            	$('#noTaxCost').val(Cost_1).attr('disabled', 'true');
            	$('#taxCost').val(Cost_2).attr('disabled', 'true');
            	$('#checkPrice').val(Cost_3).attr('disabled', 'true');
            	$('.popup-footer .btn-success').remove();
            }
		},
		
		//编辑详情
		editDetail: function(postID, spec){
			
			if (!E.isInt(postID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			
			this.tPostID = postID;
			
			this.spec = spec;
			
			E.popup.open({
                id:"popDetail",
                title: '编辑详情-' + spec,
                css: "width: 860px;height:460px;margin:-10px auto;overflow:visible;",
                btnName: "保存",
                btnCall:"goodsAdd.check(2);"
            });
			
			//ajax查询已选‘生产信息’和‘营养成分’
			E.loadding.open();
			E.ajax_post({
				url : '/invokingAjax-backend/goods/goodsAdd.ajax?operFlg=9',
				data: {
					postID: postID,
				},
				call: 'goodsAdd.call'
			});
		},
		
		//生产信息维护
		openProduct: function(){
			window.open('/quanliadmin/app/goods/goodsProduce.pscript?operFlg=1');
		},
		
		//营养成分维护
		openNutri: function(){
			window.open('/quanliadmin/app/goods/goodsNutrition.pscript?operFlg=1');
		},
		
		//批量添加生产信息
		batchProduct: function(){
			var error_msg = '';
			var l = $('#pGroupID option:checked').length;
			if (l <= 0) {
				E.alert('请添加生产信息');
				return false;
			}
			
			var params = [];
			$('#pGroupID option:checked').each(function(k, v){
				var pid = $(v).attr('value');
				if ($('#product_' + pid).length > 0) {
					error_msg = '生产信息「'+$(v).text()+'」已添加';
					return false;
				}
				params.push(pid);
			})
			
			if (error_msg != '') {
				E.alert(error_msg);
				return false;
			}
			
			E.loadding.open();
			E.ajax_post({
				url : '/invokingAjax-backend/goods/goodsProduce.ajax?operFlg=7',
				data: {
					params: params
				},
				call: 'goodsAdd.productCall'
			});
		},
		
		//查询生产信息后回调
		productCall: function(o){
			E.loadding.close();
			if (o.code == 200) {
				$('#productSel table').append(o.data);
			} else {
				E.alert(o.message);
			}
		},
		
		//批量添加营养成分信息
		batchNutri: function(){
			var error_msg = '';
			var l = $('#nGroupID option:checked').length;
			if (l <= 0) {
				E.alert('请添加营养成分信息');
				return false;
			}
			
			var params = [];
			$('#nGroupID option:checked').each(function(k, v){
				var nid = $(v).attr('value');
				if ($('#nutri_' + nid).length > 0) {
					error_msg = '营养成分信息「'+$(v).text()+'」已添加';
					return false;
				}
				params.push(nid);
			})
			
			if (error_msg != '') {
				E.alert(error_msg);
				return false;
			}
			
			E.loadding.open();
			E.ajax_post({
				url : '/invokingAjax-backend/goods/goodsNutrition.ajax?operFlg=7',
				data: {
					params: params
				},
				call: 'goodsAdd.nutriCall'
			});
		},
		
		nutriCall: function(o){
			E.loadding.close();
			if (o.code == 200) {
				$('#natriSel table').append(o.data);
			} else {
				E.alert(o.message);
			}
		},
		
		pClear: function(flg){
			$('#product_' +flg).remove();
		},
		
		nClear: function(flg){
			$('#nutri_' +flg).remove();
		},
		
		//不含税成本
		noInCost: function(postID, spec){
			if (!E.isInt(postID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			var cost = E.trim($('#noInCost_' + postID).val());
			if (!E.isNum(cost) || cost <= 0) {
				E.alert('请填写正确的不含税成本');
				return false;
			}
			this.cost = cost;
			this.costFlg = 1;
			this.costPostID = postID;
			E.confirm('您确定修改「' + spec + '」的不含税成本吗？修改后将不能再次编辑！', 'goodsAdd.confrim');
		},
		
		//含税成本
		inCost: function(postID, spec){
			if (!E.isInt(postID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			
			var cost = E.trim($('#inCost_' + postID).val());
			if (!E.isNum(cost) || cost <= 0) {
				E.alert('请填写正确的含税成本');
				return false;
			}
			
			this.cost = cost;
			this.costFlg = 2
			this.costPostID = postID;
			E.confirm('您确定修改「' + spec + '」的含税成本吗？修改后将不能再次编辑！', 'goodsAdd.confrim');
		},
		
		//销售结算价
		saleCost: function(postID, spec){
			if (!E.isInt(postID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			
			var cost = E.trim($('#saleCost_' + postID).val());
			if (!E.isNum(cost) || cost <= 0) {
				E.alert('请填写正确的销售结算价');
				return false;
			}
			
			this.cost = cost;
			this.costFlg = 3;
			this.costPostID = postID;
			E.confirm('您确定修改「' + spec + '」的销售结算价吗？修改后将不能再次编辑！', 'goodsAdd.confrim');
		},
		
		//确认修改
		confrim: function(){
			if (this.costFlg != 1 && this.costFlg != 2 && this.costFlg != 3) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			if (!E.isInt(this.costPostID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}
			
			E.loadding.open();
			E.ajax_post({
				url : '/invokingAjax-backend/goods/goodsAdd.ajax?operFlg=7',
				data: {
					postID: this.costPostID,
					flg: this.costFlg,
					cost: this.cost
				},
				call: 'goodsAdd.call'
			});
		},
		
		//回调
		call: function(o){
			E.loadding.close();
			if (o.code == 200) {
				if (o.data.type == 1) {	//保存税成本后回调
					E.popup.close();
					E.alert(o.message, 2);
					$('#noInCost_' + this.tPostID).html(o.data.noTaxCost.toFixed(2));
					$('#inCost_' + this.tPostID).html(o.data.taxCost.toFixed(2));
					$('#saleCost_' + this.tPostID).html(o.data.checkPrice.toFixed(2));
					
				} else if (o.data.type == 2) {	//保存全部
					E.popup.close();
					E.alert(o.message, 2);
					$('#ingre_' + this.tPostID).html(o.data.recipe);
					$('#net_' + this.tPostID).html(o.data.weight);
					$('#qs_' + this.tPostID).html(o.data.qsName);

				} else if (o.data.type == 3) {	//初始化显示
					
					$('#recipe').val(o.data.recipe);
					
					$('#netWeight').val(o.data.weight);
					
					$('#qsName').val(o.data.qsName);
					
					if (o.data.productTr != '') {
						$('#productSel table').html(o.data.productTr);
						$.each(o.data.product_sel, function(k, v){
							$('#pGroupID_' + v.pGroupID).val(v.pid);
						});
					}
					
					if (o.data.nutriTr != '') {
						$('#natriSel table').html(o.data.nutriTr);
						$.each(o.data.nutrition_sel, function(k, v){
							$('#nGroupID_' + v.nGroupID).val(v.nid);
							$('#npct_' + v.nGroupID).val(v.npct);
						});
					}
				}
			} else {
				E.alert(o.message);
			}
		},
		
		//检查数据
		check: function(flg){
			if (!E.isInt(this.tPostID)) {
				E.alert('参数错误，请刷新页面后重新操作');
				return false;
			}

			var error_msg = '';
			
			if (flg == 1) {	//成本
				
				this.dt = E.getFormValues('costForm');
				
				if (this.dt.noTaxCost == '') {
					error_msg += '请填写「'+this.spec+'」商品的不含税成本<br/>';
				} else if (!E.isMoney(this.dt.noTaxCost) || this.dt.noTaxCost < 0) {
					error_msg += '请填写正确的不含税成本<br/>';
				}
				
				if (this.dt.taxCost == '') {
					error_msg += '请填写「'+this.spec+'」商品的含税成本<br/>';
				} else if (!E.isMoney(this.dt.taxCost) || this.dt.taxCost < 0) {
					error_msg += '请填写正确的含税成本<br/>';
				}
				
				if (this.dt.checkPrice == '') {
					error_msg += '请填写「'+this.spec+'」商品的销售结算价<br/>';
				} else if (!E.isMoney(this.dt.checkPrice) || this.dt.checkPrice < 0) {
					error_msg += '请填写正确的销售结算价<br/>';
				}
				
				if (error_msg != '') {
					E.alert(error_msg);
					return false;
				}
				
				this.dt.postID = this.tPostID;
				E.confirm('您确认保存「'+this.spec+'」商品的成本信息吗？', 'goodsAdd.saveCost');
				
			} else {	//详情
				
				this.dt = E.getFormValues('detailForm');
				this.dt.postID = this.tPostID;
				
				if (this.dt.recipe == '') {
					error_msg += '请填写「'+this.spec+'」商品的配料信息<br/>';
				}
				
				if (this.dt.netWeight == '') {
					error_msg += '请填写「'+this.spec+'」商品的净含量<br/>';
				}
				
				if (this.dt.qsName == '') {
					error_msg += '请填写「'+this.spec+'」商品的QS生产单品名<br/>';
				}
				
				if (error_msg != '') {
					E.alert(error_msg);
					return false;
				}
				
				//生产信息维度
				var productLen = $('[name=selectPgroupID]').length;
				if (productLen <= 0) {
					E.alert('请添加生产信息维度');
					return false;
				}
				
				var msg = '';
				$('[name=selectPgroupID]').each(function(k, v){
					var pGroupID = $(this).val();
					var pid = $('#pGroupID_' + pGroupID).val();
					if (pid == 0 || pid == '') {
						msg = '请选择生产信息维度值';
						return false;
					}
				});
				if (msg != '') {
					E.alert(msg);
					return false;
				}
				
				//营养成分
				var nutriLen = $('[name=selectNgroupID]').length;
				if (nutriLen <= 0) {
					E.alert('请添加营养成分信息');
					return false;
				}
				
				$('[name=selectNgroupID]').each(function(k, v){
					var nGroupID = $(this).val();
					var nid = $('#nGroupID_' + nGroupID).val();
					var npct = E.trim($('#npct_' + nGroupID).val());
					if (nid == 0 || nid == '') {
						msg = '请选择营养成分信息值';
						return false;
					}
//					if (npct == '') {
//						msg = '请填写营养成分百分比';
//						return false;
//					}
				});
				if (msg != '') {
					E.alert(msg);
					return false;
				}

				E.confirm('您确认保存「'+this.spec+'」商品的生产信息吗？', 'goodsAdd.save');
			}
		},
		
		//保存生产成本
		saveCost: function(){
			E.ajax_post({
				url : '/invokingAjax-backend/goods/goodsAdd.ajax?operFlg=10',
				data: {
					params: goodsAdd.dt,
				},
				call: 'goodsAdd.call'
			});
		},
		
		//保存生成信息
		save: function(){
			E.loadding.open();
			E.ajax_post({
				url : '/invokingAjax-backend/goods/goodsAdd.ajax?operFlg=8',
				data: {
					params: goodsAdd.dt,
				},
				call: 'goodsAdd.call'
			});
		},
		
		npct: function(nid){
			var npct = '';
			if (nid > 0) {
				npct = $('#nGroupID_' + nid + ' option:checked').attr('npct');
			}
			
			$('#npct_' + nid).val(npct);
		}
		
	}
</script>